import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { navigationRef } from "@/utils/navigation";

import Home from "@/pages/Home";
import HomeTest from "@/pages/HomeTest";
import NetworkDebug from "@/pages/NetworkDebug";
import VideoDisplay from "@/pages/VideoDisplay";
import EntryNetwork from "@/pages/EntryNetwork";

import SqliteTest from "@/pages/Test/SqliteTest";
import SystemTest from "@/pages/Test/SystemTest";
import WebScoketTest from "@/pages/Test/WebScoketTest";

import type { RootStackParamList } from "@/router/routerType";

// https://reactnavigation.org/docs/getting-started
const Stack = createNativeStackNavigator<RootStackParamList>();

// 全局路由
const Router = () => {
  return (
    <NavigationContainer ref={navigationRef}>
      <Stack.Navigator screenOptions={{ headerShown: false }}>
        {/* 默认显示第一个 */}
        <Stack.Screen name="HomeTest" component={HomeTest} />
        <Stack.Screen name="Home" component={Home} />
        <Stack.Screen
          name="EntryNetwork"
          component={EntryNetwork}
          initialParams={{
            flag: false
          }}
        />
        <Stack.Screen name="VideoDisplay" component={VideoDisplay} />
        <Stack.Screen name="NetworkDebug" component={NetworkDebug} />

        {/* 测试页面 */}
        <Stack.Screen name="SystemTest" component={SystemTest} />
        <Stack.Screen name="WebScoketTest" component={WebScoketTest} />
        <Stack.Screen name="SqliteTest" component={SqliteTest} />
        {/* //// */}
      </Stack.Navigator>
    </NavigationContainer>
  );
};

export default Router;
